package com.shujia.day13;

import java.util.LinkedList;

public class MyStack {
    private LinkedList linkedList;

    MyStack(){
        linkedList = new LinkedList();
    }

    public void addYuanSu(Object obj){
        linkedList.addFirst(obj);
    }

    public Object getYuanSu(){
        return linkedList.removeFirst();
    }

    public int getLength(){
        return linkedList.size();
    }

    @Override
    public String toString() {
        return "MyStack{" +
                "linkedList=" + linkedList +
                '}';
    }
}
